package com.zkt.subject.infra.basic.service.impl;

import com.zkt.subject.infra.entity.SubjectInfoBO;
import com.zkt.subject.infra.basic.entity.SubjectInfo;
import com.zkt.subject.infra.basic.mapper.SubjectInfoMapper;
import com.zkt.subject.infra.basic.service.ISubjectInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 题目信息表 服务实现类
 * </p>
 *
 * @author 赵开泰
 * @since 2024-10-05
 */
@Service
public class SubjectInfoServiceImpl extends ServiceImpl<SubjectInfoMapper, SubjectInfo> implements ISubjectInfoService {
	
	@Resource
	private SubjectInfoMapper subjectInfoMapper;
	
	/**
	 * 根据条件统计总条数
	 *
	 * @param subjectInfo 统计条件
	 * @param labelId     统计标签Id
	 * @param categoryId  统计分类Id
	 * @return 统计结果
	 */
	@Override
	public long countByCondition(SubjectInfo subjectInfo, Long labelId, Long categoryId) {
		return subjectInfoMapper.countByCondition(subjectInfo, labelId, categoryId);
	}
	
	/**
	 * 根据条件查询题目列表
	 *
	 * @param subjectInfo 查询条件
	 * @param labelId     标签Id
	 * @param categoryId  分类Id
	 * @param start       起始位置
	 * @param pageSize    每页大小
	 * @return 查询结果
	 */
	@Override
	public List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long labelId, Long categoryId, int start, Integer pageSize) {
		return subjectInfoMapper.queryPage(subjectInfo, labelId, categoryId, start, pageSize);
	}
	
	/**
	 * 根据id批量查询题目详情
	 *
	 * @param subjectIds 题目id
	 * @return 题目详情
	 */
	@Override
	public List<SubjectInfoBO> querySubjectInfoByIds(List<Long> subjectIds) {
		return subjectInfoMapper.querySubjectInfoByIds(subjectIds);
	}
}
